<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	  xmlns:h="http://java.sun.com/jsf/html"
	  xmlns:f="http://java.sun.com/jsf/core"
	  xmlns:p="http://primefaces.org/ui">

<f:loadBundle basename="mensagens" var="msgs" />

<h:head>
	<meta http-equiv="content-type"
		content="text/html; charset=ISO-8859-1;" />
	<title><h:outputText value="#{msgs['sistema.titulo']}" /></title>
</h:head>
<h:body>
	<h:form id="loginPage">
		<p:growl id="growl" life="2500"/>
		<p:ajaxStatus onstart="statusDialog.show();"
			onsuccess="statusDialog.hide();" />

		<p:dialog modal="true" widgetVar="statusDialog" header="Carregando"
			draggable="false" closable="false">
			<p:graphicImage value="/resources/imagens/ajax-loader-bar.gif"></p:graphicImage>
		</p:dialog>
		<p:panel id="panel" header="#{msgs['login.label.titulo']}"
			style="margin:auto;width: 50%">
			<h:panelGrid columns="2">
				<h:outputText value="#{msgs['login.label']}" />
				<h:inputText value="#{loginController.usuarioLogin.email}" style="width:300px" />
				<h:outputText value="#{msgs['login.label.passw']}" />
				<h:inputSecret id="password" value="#{loginController.usuarioLogin.senha}" style="width:300px" />
				<h:inputHidden id="idRedirect" value="#{loginController.id}" />
			</h:panelGrid>

			<p:commandButton action="#{loginController.efetuaLogin}" update="growl" value="#{msgs['login.acao']}" />
			
			<p:commandLink value="#{msgs['login.resetaSenha.label']}"
                           actionListener="#{loginController.resetaSenha}"
                           ajax="true"
                           styleClass="linksenha"
                           update="growl"
                           oncomplete="handleResetaSenha(xhr, status, args)"
                    />
		</p:panel>
	</h:form>
    <script type="text/javascript">
        function handleResetaSenha(xhr, status, args) {
            if (!args.validationFailed &amp;&amp; args.sucesso) {
                alert("#{msgs['login.resetaSenha.enviado']}");
            }
        }
    </script>
</h:body>
</html>